package com.qubaopen.survey.util;

import java.io.BufferedReader;
import java.io.IOException;

import javax.servlet.http.HttpServletRequest;

import net.sf.json.JSONObject;

public class StringUtil {
	public static JSONObject getJSONObjectFromRequest(HttpServletRequest request) {
		
		StringBuffer jb = new StringBuffer();
		String line = null;

		BufferedReader reader;
		try {
			reader = request.getReader();
			while ((line = reader.readLine()) != null)
				jb.append(line);
			
			return JSONObject.fromObject(jb.toString());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

}
